﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jenvin.Library.Cache;
namespace Cache
{
    public class Cache<Tkey, TValue>
    {
        public ICacheStorage<Tkey, TValue> Storage { get; set; }

        public CacheConfig<Tkey, TValue> CacheConfig { get; set; }

        public TValue Get(Tkey key)
        {
            return CacheHelper.Get<TValue>(delegate(out TValue value)
            {
                TValue data = Storage.Get(key);
                return data != null;
            }, () => {

                return default(TValue);
            }, data => {
                Storage.Set(key, data);
            });
        }
    }

    public class CacheConfig<TKey, TValue>
    {

    }

    public class CacheFactory
    {
        //
    }
}
